package cn.jsoup;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.File;
import java.io.IOException;

public class jsoupDemo3 {
    public static void main(String[] args) throws IOException {
        String path = jsoupDemo3.class.getClassLoader().getResource("student.xml").getPath();
        Document document1 = Jsoup.parse(new File("D:\\Ultimate IDEA\\myXML\\out\\production\\Jsoup_Using\\student.xml"), "utf-8");

        Element test1 = document1.getElementById("01");
        System.out.println(test1);

        System.out.println("-----------");
        Elements test2 = document1.getElementsByTag("name");
        System.out.println(test2);

        System.out.println("-----------");
        Elements test3 = document1.getElementsByAttribute("id");
        System.out.println(test3);

        System.out.println("------------");
        Elements test4 = document1.getElementsByAttributeValue("id", "02");
        System.out.println(test4);
    }
}
